# DP: Report an ICE to apport (if apport is available
# DP: and the environment variable GCC_NOAPPORT is not set)

---
 gcc/gcc.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

--- a/src/gcc/gcc.c
+++ b/src/gcc/gcc.c
@@ -6325,6 +6325,15 @@ retry_ice (const char *prog, const char **argv)
 	    {
 	      notice ("Preprocessed source stored into %s file, please attach this to your bugreport.\n",
 		      temp_filenames[attempt * 2]);
+	      if (!getenv ("GCC_NOAPPORT")
+		  && !access ("/usr/share/apport/gcc_ice_hook", R_OK | X_OK))
+		{
+		  char *cmd = xmalloc (50 + strlen (temp_filenames[attempt * 2]) + strlen (new_argv[0]));
+		  sprintf (cmd, "/usr/share/apport/gcc_ice_hook %s %s",
+			   new_argv[0], temp_filenames[attempt * 2]);
+		  system (cmd);
+		  free (cmd);
+		}
 	      /* Make sure it is not deleted.  */
 	      free (temp_filenames[attempt * 2]);
 	      temp_filenames[attempt * 2] = NULL;
